package com.qiaofang.dataprocessing.service.impl;

import com.qiaofang.dataprocessing.dao.EmployeeDao;
import com.qiaofang.dataprocessing.service.EmployeeService;
import com.qiaofang.dataprocessing.stub.bean.EmpManageDTO;
import com.qiaofang.dataprocessing.stub.bean.EmpSupplementDTO;
import com.qiaofang.dataprocessing.stub.bean.EmployeeCountDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * Created by IDEA.
 *
 * @auther Zym.
 * @company qiaofang
 * @date 2020/11/18 17:18
 */
@Service
@Slf4j
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeDao employeeDao;


    @Override
    public EmpManageDTO getEmpManageDTO() {
        EmpManageDTO empManageDTO = new EmpManageDTO();
        List<String> dimissionEmpUuid = employeeDao.getDimissionEmpUuid();
        if (!CollectionUtils.isEmpty(dimissionEmpUuid)){
            empManageDTO.setDimissionUuidList(dimissionEmpUuid);
        }
        List<EmpSupplementDTO> allEmpSupplement = employeeDao.getAllEmpSupplement();
        if (!CollectionUtils.isEmpty(allEmpSupplement)){
            empManageDTO.setSupplementList(allEmpSupplement);
        }
        return empManageDTO;
    }

    @Override
    public List<EmployeeCountDTO> getInspectionCountList() {
        return employeeDao.getInspectionCountList();
    }

    @Override
    public List<EmployeeCountDTO> getTransactionCountList() {
        return employeeDao.getTransactionCountList();
    }
}
